package com.htthorizon.system.excel.service;

import com.alibaba.excel.EasyExcel;
import com.htthorizon.system.excel.excel.UserExcel;
import com.htthorizon.system.excel.listener.UserExcelUploadListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @author Brilliant
 */
@Service
public class UserExcelServiceImpl implements UserExcelService{

    @Autowired
    private UserExcelUploadListener userExcelUploadListener;
    @Override
    public boolean uploadUserExcel(MultipartFile file) throws IOException {
        EasyExcel.read(file.getInputStream(), UserExcel.class, userExcelUploadListener).sheet().headRowNumber(1).doRead();
        return true;
    }
}
